/*************
 **
 ** Project:      stopwatch
 ** File info:    $Id: Highlighter.qml 15 2012-05-03 03:37:27Z Kuzma.Shapran@gmail.com $
 ** Author:       Copyright (C) 2011 Kuzma Shapran <Kuzma.Shapran@gmail.com>
 ** License:      GPLv3
 **
 **  This file is part of Stopwatch.
 **
 **  Stopwatch is free software: you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License as published by
 **  the Free Software Foundation, either version 3 of the License, or
 **  (at your option) any later version.
 **
 **  Stopwatch is distributed in the hope that it will be useful,
 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 **  GNU General Public License for more details.
 **
 **  You should have received a copy of the GNU General Public License
 **  along with Stopwatch.  If not, see <http://www.gnu.org/licenses/>.
 **
 *************/


import QtQuick 1.1

Rectangle {
    id: root
    anchors.fill: parent
    color: "#f74000"
    visible: false
    opacity: 0.0
    signal finished

    Timer {
        id: timer
        interval: 2000
        onTriggered: root.finished()
    }

    SequentialAnimation {
        id: flashAnimation
        PropertyAnimation {
            target: root
            property: "visible"
            duration: 0
            to: true
        }
        NumberAnimation {
            target: root
            property: "opacity"
            duration: 1000
            to: 1.0
        }
        NumberAnimation {
            target: root
            property: "opacity"
            duration: 1000
            to: 0.0
        }
        PropertyAnimation {
            target: root
            property: "visible"
            duration: 0
            to: false
        }
    }

    function flash()
    {
        flashAnimation.start();
        timer.start()
    }
}
